import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'index_get_user_response.freezed.dart';
part 'index_get_user_response.g.dart';

@freezed
class IndexGetUserResponse with _$IndexGetUserResponse {
  const factory IndexGetUserResponse({
    @JsonKey(name: "code") required int code,
    @JsonKey(name: "msg") required String msg,
    @JsonKey(name: "time") required int time,
    @JsonKey(name: "data") required Data data,
  }) = _IndexGetUserResponse;

  factory IndexGetUserResponse.fromJson(Map<String, dynamic> json) =>
      _$IndexGetUserResponseFromJson(json);
}

@freezed
class Data with _$Data {
  const factory Data({
    @JsonKey(name: "userinfo") required Userinfo userinfo,
  }) = _Data;

  factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json);
}

@freezed
class Userinfo with _$Userinfo {
  const factory Userinfo({
    @JsonKey(name: "medal_list") required List<dynamic> medalList,
    @JsonKey(name: "avatar") required String avatar,
    @JsonKey(name: "truehead") required String truehead,
    @JsonKey(name: "nickname") required String nickname,
    @JsonKey(name: "city") required String city,
    @JsonKey(name: "lv") required int lv,
    @JsonKey(name: "dec") required String dec,
    @JsonKey(name: "is_see_follow") required int isSeeFollow,
    @JsonKey(name: "is_see_fans") required int isSeeFans,
    @JsonKey(name: "fansi") required int fansi,
    @JsonKey(name: "guanzhu") required int guanzhu,
    @JsonKey(name: "zhan") required int zhan,
    @JsonKey(name: "sex") required int sex,
    @JsonKey(name: "is_follow") required bool isFollow,
    @JsonKey(name: "bg_img") required String bgImg,
  }) = _Userinfo;

  factory Userinfo.fromJson(Map<String, dynamic> json) =>
      _$UserinfoFromJson(json);
}
